classdef NVNA < Instrument 
    
    properties
        frequency;
        startFrequency;
        stopFrequency;
        power;
        startPower;
        stopPower;
        sweepPoints;
        source_port;
        bandwidth;
        sweepCount;
        sweepType;
        singleSweep;
    end
        
    methods
        
        function this = NVNA(GPIB_controller, GPIB_address, address)
            this = this@Instrument(GPIB_controller, GPIB_address, address);
        end
       
        function this = set.frequency(this, value)
            
            this.frequency = value;
            this.setFreq();
        end
        
        function this = set.startFrequency(this, value)
            
            this.startFrequency = value;
            this.setStartFreq();
        end
        
        function this = set.stopFrequency(this, value)
            
            this.stopFrequency = value;
            this.setStopFreq();
        end
        
        function this = set.power(this, value)
            
            this.power = value;
            this.setPower();
        end
        
        function this = set.startPower(this, value)
            
            this.startPower = value;
            this.setStartPower();
        end
        
        function this = set.stopPower(this, value)
            
            this.stopPower = value;
            this.setStopPower();
        end
        
        function this = set.sweepPoints(this, value)
            
            this.sweepPoints = value;
            this.setSweepPoints();
        end
        
        function this = set.sweepCount(this,value)
            
            this.sweepCount = value;
            this.setSweepCount();
        end
        
        function this = set.sweepType(this, value)
            
            this.sweepType = value;
            this.setSweepType();
        end
        
        function this = set.bandwidth(this, value)
            
            this.bandwidth = value;
            this.setResolutionBandwidth();
        end
        
    end
    
    methods(Static)
        function out = parseParameter(begin,numberOfPoints, input, complex)
        
             iter = 1;
             if complex == 1
                for i=1:2:numberOfPoints*2
                    out(iter) = input(begin-1+i)+1i*input(begin-1+i+1);
                    iter=iter+1;
                end
             else
               for i=1:1:numberOfPoints
                   out(iter) = input(begin-1+i);
                   iter=iter+1;
               end
            end
            
           
        end
            
    
        
    
    end
   
end